<%@ page import="org.tigr.htc.common.*, java.util.Enumeration" %>
<%
  String[] colors = new String[] { "#c98300", "#ececec" };
%>
<html>
<head>
</head>

<body>
<%
  String sname = request.getParameter("sub_name");
  String svalue = request.getParameter("sub_value");

  if(sname != null) {
     if(svalue != null) { 
	HTCConfig.setProperty(sname, svalue);
%>

<h2> submitted update <%= sname %> to <%= svalue %> </h2>

<%   } else { %>

<h2> Error: submitted update <%= sname %> but value was null</h2>

  <% } %>
<% } %>


<H1> HTC Service Configuration Page </H1>
<table border=1>
<tr bgcolor=#BFE2F9>
<td>Property Name</td>
<td>Property Value</td>
<td>Actions </td>
</tr>

<%
  Enumeration names = HTCConfig.propertyNames();


  for (int i=0; names.hasMoreElements() ; i++) {
        String pname = (String) names.nextElement();
	String pvalue = HTCConfig.getProperty(pname);
%>
<form method="post" action="config.jsp">
<input type="hidden" name="sub_name" value="<%=pname %>" />
<tr bgcolor="<%= colors[(i % 2)] %>">
<td><%= pname %></td>
<td><input type="text" name="sub_value" value="<%=pvalue %>" size="100" /></td>
<td><input type="submit" value="update" /> </td>
</tr>
</form>
<% } %>
<form action="config.jsp">

<tr bgcolor=#ccccc>
<td><input type="text" name="sub_name" " /></td>
<td><input type="text" name="sub_value" " /></td>
<td><input type="submit" value="update" /> </td>
</tr>
</form>

</table>

</body>
</html>
